package exercise5;



import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Exercise11_13 {
    public static void main(String []args){
        Scanner input=new Scanner(System.in);
        System.out.println("请输入10个数字：");
        ArrayList<Integer> list=new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(input.nextInt());
        }

        removeDuplicate(list);

        for (int i = 0; i < list.size(); i++){
            System.out.print(list.get(i) + " ");
        }

    }

    public static void removeDuplicate(ArrayList<Integer> list){
        Collections.sort(list);
        int a=list.get(0);
        int l=list.size();
        for (int i=1;i<l;i++){
            if (list.get(i).equals(a)){
                list.remove(i);
                l--;
            }
            a=list.get(i);
        }
    }
}
